package com.macro.mall.service.impl;

import com.macro.mall.dto.BannerPicDto;
import com.macro.mall.dto.DesiginAreaDto;
import com.macro.mall.dto.TenantInfoDto;
import com.macro.mall.mapper.PlatFormMapper;
import com.macro.mall.model.BannerPicEntity;
import com.macro.mall.model.CaseEntity;
import com.macro.mall.model.TenantEntity;
import com.macro.mall.service.PlatFromService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 平台管理实现
 */
@Service
public class PlatFromServiceImpl implements PlatFromService {
    @Autowired
    private PlatFormMapper platFormMapper;

    @Override
    public List<TenantEntity> findTenantList(Integer status, Integer curPage, Integer pageSize) {
        Integer skip = (curPage-1)*pageSize;
        return platFormMapper.findTenantList(status, skip, pageSize);
    }

    @Override
    public int findTenantCount(Integer status) {
        return platFormMapper.findTenantCount(status);
    }

    @Override
    public void addTenant(TenantInfoDto tenantInfoDto) {
        platFormMapper.addTenant(tenantInfoDto);
    }

    @Override
    public void examineTenant(Integer status, Long tenantId) {
        platFormMapper.examineTenant(status,tenantId);
    }

    @Override
    public void recommendTenant(Integer isRecommend, Long tenantId) {
        platFormMapper.recommendTenant(isRecommend, tenantId);
    }

    @Override
    public void deleteTenant(Long id) {
        platFormMapper.deleteTenant(id);
        platFormMapper.deleteUser(id);
    }

    @Override
    public void addBannerPics(BannerPicDto bannerPicDto) {
        platFormMapper.addBannerPics(bannerPicDto);
    }

    @Override
    public BannerPicEntity findBannerPicsInfo(Long id) {
        return platFormMapper.findBannerPicsInfo(id);
    }

    @Override
    public void updateBannerPics(BannerPicDto bannerPicDto) {
        platFormMapper.updateBannerPics(bannerPicDto);
    }

    @Override
    public void deleteBannerPics(Long bannerId) {
        platFormMapper.deleteBannerPics(bannerId);
    }

    @Override
    public int findAllCaseNum() {
        return platFormMapper.findAllCaseNum();
    }

    @Override
    public List<CaseEntity> findAllCaseList(Integer pageSize, Integer curPage) {
        Integer skip = (curPage-1)*pageSize;
        return platFormMapper.findAllCaseList(skip, pageSize);
    }

    @Override
    public void recommendCase(Integer isRecommend, Long caseId) {
        platFormMapper.recommendCase(isRecommend,caseId);
    }

    @Override
    public void deleteCase(Long caseId) {
        platFormMapper.deleteCase(caseId);
    }

    @Override
    public int findBannerPicsNum() {
        return platFormMapper.findBannerPicsNum();
    }

    @Override
    public List<BannerPicEntity> findBannerPicList(Integer curPage, Integer pageSize) {
        Integer skip = (curPage-1)*pageSize;
        return platFormMapper.findBannerPicList(skip,pageSize);
    }

    @Override
    public List<DesiginAreaDto> findDesiginArea(Integer curPage, Integer pageSize) {
        Integer skip = (curPage-1)*pageSize;
        return platFormMapper.findDesiginArea(skip,pageSize);
    }

    @Override
    public int findDesiginAreaCount() {
        return platFormMapper.findDesiginAreaCount();
    }

    @Override
    public void addDesiginArea(DesiginAreaDto desiginAreaDto) {
        platFormMapper.addDesiginArea(desiginAreaDto);
    }

    @Override
    public int findAreaNameCount(DesiginAreaDto desiginAreaDto) {
        return platFormMapper.findAreaNameCount(desiginAreaDto);
    }

    @Override
    public void deleteDesiginArea(Long areaId) {
        platFormMapper.deleteDesiginArea(areaId);
    }

    @Override
    public void updateDesiginArea(DesiginAreaDto desiginAreaDto) {
        platFormMapper.updateDesiginArea(desiginAreaDto);
    }

    @Override
    public List<DesiginAreaDto> findUserList() {
        return platFormMapper.findUserList();
    }
}
